﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace PlasmaMes
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            bool createNew;
            using (Mutex mutex = new Mutex(true, Application.ProductName, out createNew))
            {
                if (createNew)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.Run(new MainForm());
                    //if (SystemConfig.InitConfig())//载入参数
                    //{
                    //    SystemConfig.InitSystem();//初始化系统,硬件相关                        
                    //    Application.Run(new Form_Main());
                    //    SystemConfig.DeinitSystem();//反初始化系统     
                    //   // System.Environment.Exit(0);  //正常退出
                    //    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    //}
                }
                else
                {
                    MessageBox.Show("程序已经在运行中，请勿重复启动");
                    System.Threading.Thread.Sleep(500);
                    System.Environment.Exit(1);
                }

            }
        }
    }
}
